package com.credithc.customers.base.mapper;

import com.credithc.baseserv.core.mapper.BsBaseMapper;
import com.credithc.customers.base.po.PreCustomerPasswdPo;
import com.credithc.customers.base.vo.UnifyInfoVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author fby
 * @date 2020/01/14 15:14
 */
@Mapper
@Repository
public interface PreCustomerPassMapper extends BsBaseMapper<PreCustomerPasswdPo> {
    @Select("select A.id,A.mobile,A.passwd,A.pre_customer_no preCustomerNo,A.sub_system_sign subSystemSign from cust_pre_passwd A JOIN cust_extend B ON A.pre_customer_no=B.pre_customer_no AND A.sub_system_sign=B.sub_system_sign AND B.status=1" +
            " where A.mobile=#{mobile} and A.sub_system_sign=#{subSystemSign}")
    List<PreCustomerPasswdPo> getUnifyInfo(@Param("mobile") String mobile, @Param("subSystemSign") String subSystemSign, @Param("systemSign") String systemSign);

    @Select("select A.id,A.contact_info mobile,A.pre_customer_no preCustomerNo,B.id extendId from cust_pre_info A JOIN cust_extend B ON A.pre_customer_no=B.pre_customer_no AND B.status=1" +
            " where A.contact_info=#{mobile} and A.contact_type='1' and B.sub_system_sign=#{subSystemSign}")
    List<UnifyInfoVo> getUnifyLoginInfo(@Param("mobile") String mobile, @Param("subSystemSign") String subSystemSign, @Param("systemSign") String systemSign);

}
